/**
 * 
 */
package GUI;

import javax.swing.*;

import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;

/**
 * @author aviat
 *
 */
public class eventHandling extends JPanel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JButton btnBack;
	private JButton btnEditEvent;
	private JButton btnCancelEvent;
	private JButton btnCreateEvent;
	private JButton btnCloseEvent;
	private JLabel iconlabel;
	private JButton btnViewEvent;
	private JButton btnPlayVideo;
	private JFileChooser Chooser;
	
	public eventHandling() {
		setBackground(new Color(255, 51, 0));
		setLayout(null);
		btnBack = new JButton("Back");
		btnBack.setIcon(new ImageIcon(eventHandling.class.getResource("/resources/back22.png")));
		btnEditEvent = new JButton("Edit Event");
		btnEditEvent.setIcon(new ImageIcon(eventHandling.class.getResource("/resources/eraser.png")));
		btnCancelEvent = new JButton("Cancel Event");
		btnCancelEvent.setIcon(new ImageIcon(eventHandling.class.getResource("/resources/stop_sign.png")));
		btnCreateEvent = new JButton("Create Event");
		btnCreateEvent.setIcon(new ImageIcon(eventHandling.class.getResource("/resources/create.png")));
		btnCloseEvent = new JButton("Close Event");
		btnCloseEvent.setIcon(new ImageIcon(eventHandling.class.getResource("/resources/lock.png")));
		btnViewEvent = new JButton("View Event");
		btnViewEvent.setIcon(new ImageIcon(eventHandling.class.getResource("/resources/1402779782_rings.png")));
		btnPlayVideo = new JButton("Play Video");
		Chooser = new JFileChooser();
		btnPlayVideo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				File F = new File("C:/");
				File  NamePath=null;
				int Checker;
				Chooser.setCurrentDirectory(F);
				Chooser.setDialogTitle("Choose a file");
				Checker = Chooser.showOpenDialog(null);
				
				if(Checker == JFileChooser.APPROVE_OPTION){
					NamePath = Chooser.getSelectedFile();
					try {
						Desktop.getDesktop().open(NamePath);
					} catch (IOException e1) {
						e1.printStackTrace();
					}
				}
			}
		});
		
		
		initialize();
		
	}

	private void initialize() {
		
		btnEditEvent.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
		btnCancelEvent.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
		btnCreateEvent.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
		btnCloseEvent.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
		
		JLabel lblEvent = new JLabel("Event");
		lblEvent.setForeground(new Color(0, 204, 255));
		lblEvent.setFont(new Font("Tahoma", Font.BOLD, 16));
		lblEvent.setBounds(10, 11, 146, 28);
		add(lblEvent);
		
		btnBack.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
		btnBack.setBounds(10, 462, 101, 27);
		add(btnBack);
		
		btnEditEvent.setBounds(454, 57, 146, 45);
		add(btnEditEvent);
		
		
		btnCancelEvent.setBounds(168, 189, 146, 45);
		add(btnCancelEvent);
		
		
		btnCreateEvent.setBounds(168, 57, 146, 45);
		add(btnCreateEvent);
		
		
		btnCloseEvent.setBounds(454, 189, 146, 45);
		add(btnCloseEvent);
		
		ImageIcon LOGOImageIcon = new ImageIcon(getClass().getClassLoader().getResource("resources/camera-background3.png"));
		ImageIcon LOGO = new ImageIcon (LOGOImageIcon.getImage().getScaledInstance(-1, -1, java.awt.Image.SCALE_SMOOTH));
		
		btnViewEvent.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
		btnViewEvent.setBounds(168, 316, 146, 45);
		add(btnViewEvent);
		
		btnPlayVideo.setIcon(new ImageIcon(eventHandling.class.getResource("/resources/play.png")));
		btnPlayVideo.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
		btnPlayVideo.setBounds(454, 316, 146, 45);
		add(btnPlayVideo);
		
		iconlabel = new JLabel("");
		iconlabel.setIcon(LOGO);
		iconlabel.setBounds(0, 0, 786, 500);
		add(iconlabel);
		
	}

	/**
	 * @return the btnBack
	 */
	public JButton getBtnBack() {
		return btnBack;
	}

	/**
	 * @param btnBack the btnBack to set
	 */
	public void setBtnBack(JButton btnBack) {
		this.btnBack = btnBack;
	}

	/**
	 * @return the btnEditEvent
	 */
	public JButton getBtnEditEvent() {
		return btnEditEvent;
	}

	/**
	 * @param btnEditEvent the btnEditEvent to set
	 */
	public void setBtnEditEvent(JButton btnEditEvent) {
		this.btnEditEvent = btnEditEvent;
	}

	/**
	 * @return the btnCancelEvent
	 */
	public JButton getBtnCancelEvent() {
		return btnCancelEvent;
	}

	/**
	 * @param btnCancelEvent the btnCancelEvent to set
	 */
	public void setBtnCancelEvent(JButton btnCancelEvent) {
		this.btnCancelEvent = btnCancelEvent;
	}

	/**
	 * @return the btnCreateEvent
	 */
	public JButton getBtnCreateEvent() {
		return btnCreateEvent;
	}

	/**
	 * @param btnCreateEvent the btnCreateEvent to set
	 */
	public void setBtnCreateEvent(JButton btnCreateEvent) {
		this.btnCreateEvent = btnCreateEvent;
	}

	/**
	 * @return the btnCloseEvent
	 */
	public JButton getBtnCloseEvent() {
		return btnCloseEvent;
	}

	/**
	 * @param btnCloseEvent the btnCloseEvent to set
	 */
	public void setBtnCloseEvent(JButton btnCloseEvent) {
		this.btnCloseEvent = btnCloseEvent;
	}

	/**
	 * @return the btnViewEvent
	 */
	public JButton getBtnViewEvent() {
		return btnViewEvent;
	}

	/**
	 * @param btnViewEvent the btnViewEvent to set
	 */
	public void setBtnViewEvent(JButton btnViewEvent) {
		this.btnViewEvent = btnViewEvent;
	}

	/**
	 * @return the btnPlayVideo
	 */
	public JButton getBtnPlayVideo() {
		return btnPlayVideo;
	}

	/**
	 * @param btnPlayVideo the btnPlayVideo to set
	 */
	public void setBtnPlayVideo(JButton btnPlayVideo) {
		this.btnPlayVideo = btnPlayVideo;
	}


}
